RichText Issue

I'm new to DXL and in a previous post I saw an idea that looks similar to what I need to do. I did some research and was able to get the following code however I can't seem to get the replace part. All I want to do is replace a symbol, (probably like in the example from the post I got the idea from https://www.ibm.com/developerworks/forums/thread.jspa?threadID=439831&tstart=15) replace an attribute text (Example: The car shall run ?) All I want to replace is the symbol (?) with text from another attribute. What do I need to do to accomplish the replace ?.
 

Object o = current
string s = richTextWithOle(o."Requirement")
string r = richTextWithOle(o."Generic Requirement")
o."Generic Requirement" = richText(r)(s)

 


Any ideas on what I need to change to make this happen?

 


Mike_Peters - Mon Jul 16 22:36:18 EDT 2012

Re: RichText Issue
kavitharassou - Wed Jul 18 03:31:27 EDT 2012

Please refer the replaceRichText function in the dxl reference manual.It could be helpfull.
Here is the declaration for the replace function:

string replaceRichText(string s,
int offset,
int length,
string r)
Example:
RichText rt
string s = "ghkgjuikjklghk"
string r = "bOLD"
string result = replaceRichText(s, 4, 8, r)
print result "\n"

4 is the offset and 8 is the length.

here is the result:ghkgbOLDhk

Note that the text from j(in 4th position) up to g (length 8 counted from offset)is replaced by the text "BOLD".

I hope with this you can get what you need.